<template>
  <view>
    <van-tabbar :active="active" @change="onChange">
      <van-tabbar-item
        v-for="item in routerList"
        :key="item.url"
        :icon="item.icon"
      >
        {{ item.text }}
      </van-tabbar-item>
    </van-tabbar>
  </view>
</template>

<script>
import  routerList  from './data'
export default {
  data() {
    return {
      active: 0,
      routerList,
    }
  },
  methods: {
    onChange(event) {
      this.active = event.detail
      console.log('this.avtive', this.active)
      // 路由跳转 switchTab 跳转tabBar页面
      wx.switchTab({
        url: this.routerList[event.detail].url,
      })
    },
  },
}
</script>

<style></style>
